* Apply to: roadmaps_1.dta
* Description:  Tables A5 and A6 in the OA

clear

set more off


use "...\1805 Roadmaps\roadmaps_1.dta", clear


* Treatment variables

gen con = 0
replace con = 1 if ctr_marlee!=.

gen vgd = 0
replace vgd = 1 if vgd_marlee!=.

gen pty = 0
replace pty = 1 if pty_marlee!=.

gen psi = 0
replace psi = 1 if psi_marlee!=.

gen psp = 0
replace psp = 1 if psp_marlee!=.

gen an3 = 0
replace an3 = 1 if end_marlee!=.
replace an3 = 1 if end_ideo_marlee!=.


gen all_info = 0
replace all_info = 1 if (vgd==1 | pty==1 | psi==1 | psp==1)


* Drop extraneous respondents

drop if an3==1
drop if party=="Other"
drop if (con==0 & vgd==0 & pty==0 & psi==0 & psp==0)
drop end_marlee end_ideo_marlee


* Dependent variables

gen marlee = ctr_marlee
replace marlee = vgd_marlee if vgd==1
replace marlee = pty_marlee if pty==1
replace marlee = psi_marlee if psi==1
replace marlee = psp_marlee if psp==1

gen vote_marlee = 0
replace vote_marlee = 1 if marlee==1
replace vote_marlee = . if marlee==3

gen vote_leemar = 1
replace vote_leemar = 0 if marlee==1
replace vote_leemar = . if marlee==3


* Knowledge interactions

gen con_lo = 0
replace con_lo = 1 if con==1 & know_hi==0

gen vgd_lo = 0
replace vgd_lo = 1 if vgd==1 & know_hi==0

gen pty_lo = 0
replace pty_lo = 1 if pty==1 & know_hi==0

gen psi_lo = 0
replace psi_lo = 1 if psi==1 & know_hi==0

gen psp_lo = 0
replace psp_lo = 1 if psp==1 & know_hi==0


gen all_info_lo = 0
replace all_info_lo = 1 if all_info==1 & know_hi==0


gen con_hi = 0
replace con_hi = 1 if con==1 & know_hi==1

gen vgd_hi = 0
replace vgd_hi = 1 if vgd==1 & know_hi==1

gen pty_hi = 0
replace pty_hi = 1 if pty==1 & know_hi==1

gen psi_hi = 0
replace psi_hi = 1 if psi==1 & know_hi==1

gen psp_hi = 0
replace psp_hi = 1 if psp==1 & know_hi==1


gen all_info_hi = 0
replace all_info_hi = 1 if all_info==1 & know_hi==1


* Treatment-ideology interactions

gen con_lo_D1 = con_lo * d1
gen vgd_lo_D1 = vgd_lo * d1
gen pty_lo_D1 = pty_lo * d1
gen psi_lo_D1 = psi_lo * d1
gen psp_lo_D1 = psp_lo * d1

gen all_info_lo_D1 = all_info_lo * d1


gen con_hi_D1 = con_hi * d1
gen vgd_hi_D1 = vgd_hi * d1
gen pty_hi_D1 = pty_hi * d1
gen psi_hi_D1 = psi_hi * d1
gen psp_hi_D1 = psp_hi * d1

gen all_info_hi_D1 = all_info_hi * d1


set more off

*log using "...\1805 Roadmaps\Table A5.log", replace

set seed X075bcd151f123bb5159a55e50022865700043e55


probit vote_leemar ///
     con_lo con_lo_D1 ///
     vgd_lo vgd_lo_D1 ///
     pty_lo pty_lo_D1 ///
     psi_lo psi_lo_D1 ///
     psp_lo psp_lo_D1 ///
     con_hi con_hi_D1 ///
     vgd_hi vgd_hi_D1 ///
     pty_hi pty_hi_D1 ///
     psi_hi psi_hi_D1 ///
     psp_hi psp_hi_D1 ///
     , noconstant

tabstat d1 if e(sample), s(n mean sd min p25 p50 p75 max)


estsimp probit vote_leemar ///
     con_lo con_lo_D1 ///
     vgd_lo vgd_lo_D1 ///
     pty_lo pty_lo_D1 ///
     psi_lo psi_lo_D1 ///
     psp_lo psp_lo_D1 ///
     con_hi con_hi_D1 ///
     vgd_hi vgd_hi_D1 ///
     pty_hi pty_hi_D1 ///
     psi_hi psi_hi_D1 ///
     psp_hi psp_hi_D1 ///
     , noconstant


* Low-knowledge

setx median
setx con_lo 1
setx con_lo_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_con)) changex(con_lo_D1 .0415 1.026)


setx con_lo_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_vgd_con)) changex(con_lo 1 0 vgd_lo 0 1)
simqi, fd(prval(1) genpr(tr_pty_con)) changex(con_lo 1 0 pty_lo 0 1)
simqi, fd(prval(1) genpr(tr_psi_con)) changex(con_lo 1 0 psi_lo 0 1)
simqi, fd(prval(1) genpr(tr_psp_con)) changex(con_lo 1 0 psp_lo 0 1)


setx median
setx vgd_lo 1
setx vgd_lo_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_vgd)) changex(vgd_lo_D1 .0415 1.026)


setx vgd_lo_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_pty_vgd)) changex(vgd_lo 1 0 pty_lo 0 1)
simqi, fd(prval(1) genpr(tr_psi_vgd)) changex(vgd_lo 1 0 psi_lo 0 1)
simqi, fd(prval(1) genpr(tr_psp_vgd)) changex(vgd_lo 1 0 psp_lo 0 1)


setx median
setx pty_lo 1
setx pty_lo_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_pty)) changex(pty_lo_D1 .0415 1.026)


setx pty_lo_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_psi_pty)) changex(pty_lo 1 0 psi_lo 0 1)
simqi, fd(prval(1) genpr(tr_psp_pty)) changex(pty_lo 1 0 psp_lo 0 1)


setx median
setx psi_lo 1
setx psi_lo_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_psi)) changex(psi_lo_D1 .0415 1.026)


setx psi_lo_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_psp_psi)) changex(psi_lo 1 0 psp_lo 0 1)


setx median
setx psp_lo 1
setx psp_lo_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_psp)) changex(psp_lo_D1 .0415 1.026)


setx psp_lo_D1 0
simqi, pr listx


* Difference in baseline probabilities

tabstat tr_vgd_con, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_pty_con, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psi_con, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psp_con, s(mean sd min p5 p10 p50 p90 p95 max)


tabstat tr_pty_vgd, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psi_vgd, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psp_vgd, s(mean sd min p5 p10 p50 p90 p95 max)


tabstat tr_psi_pty, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psp_pty, s(mean sd min p5 p10 p50 p90 p95 max)


tabstat tr_psp_psi, s(mean sd min p5 p10 p50 p90 p95 max)


* Calculate difference in first differences

gen dif_vgd_con = fd_vgd - fd_con
gen dif_pty_con = fd_pty - fd_con
gen dif_psi_con = fd_psi - fd_con
gen dif_psp_con = fd_psp - fd_con

tabstat dif_vgd_con, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_pty_con, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psi_con, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_con, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_pty_vgd = fd_pty - fd_vgd
gen dif_psi_vgd = fd_psi - fd_vgd
gen dif_psp_vgd = fd_psp - fd_vgd

tabstat dif_pty_vgd, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psi_vgd, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_vgd, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_psi_pty = fd_psi - fd_pty
gen dif_psp_pty = fd_psp - fd_pty

tabstat dif_psi_pty, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_pty, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_psp_psi = fd_psp - fd_psi

tabstat dif_psp_psi, s(mean sd min p5 p10 p50 p90 p95 max)


* High-knowledge

setx median
setx con_hi 1
setx con_hi_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_con_hi)) changex(con_hi_D1 .0415 1.026)


setx con_hi_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_vgd_con_hi)) changex(con_hi 1 0 vgd_hi 0 1)
simqi, fd(prval(1) genpr(tr_pty_con_hi)) changex(con_hi 1 0 pty_hi 0 1)
simqi, fd(prval(1) genpr(tr_psi_con_hi)) changex(con_hi 1 0 psi_hi 0 1)
simqi, fd(prval(1) genpr(tr_psp_con_hi)) changex(con_hi 1 0 psp_hi 0 1)


setx median
setx vgd_hi 1
setx vgd_hi_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_vgd_hi)) changex(vgd_hi_D1 .0415 1.026)


setx vgd_hi_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_pty_vgd_hi)) changex(vgd_hi 1 0 pty_hi 0 1)
simqi, fd(prval(1) genpr(tr_psi_vgd_hi)) changex(vgd_hi 1 0 psi_hi 0 1)
simqi, fd(prval(1) genpr(tr_psp_vgd_hi)) changex(vgd_hi 1 0 psp_hi 0 1)


setx median
setx pty_hi 1
setx pty_hi_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_pty_hi)) changex(pty_hi_D1 .0415 1.026)


setx pty_hi_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_psi_pty_hi)) changex(pty_hi 1 0 psi_hi 0 1)
simqi, fd(prval(1) genpr(tr_psp_pty_hi)) changex(pty_hi 1 0 psp_hi 0 1)


setx median
setx psi_hi 1
setx psi_hi_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_psi_hi)) changex(psi_hi_D1 .0415 1.026)


setx psi_hi_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_psp_psi_hi)) changex(psi_hi 1 0 psp_hi 0 1)


setx median
setx psp_hi 1
setx psp_hi_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_psp_hi)) changex(psp_hi_D1 .0415 1.026)


setx psp_hi_D1 0
simqi, pr listx


* Difference in baseline probabilities

tabstat tr_vgd_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_pty_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psi_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psp_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)


tabstat tr_pty_vgd_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psi_vgd_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psp_vgd_hi, s(mean sd min p5 p10 p50 p90 p95 max)


tabstat tr_psi_pty_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psp_pty_hi, s(mean sd min p5 p10 p50 p90 p95 max)


tabstat tr_psp_psi_hi, s(mean sd min p5 p10 p50 p90 p95 max)


* Calculate difference in first differences

gen dif_vgd_con_hi = fd_vgd_hi - fd_con_hi
gen dif_pty_con_hi = fd_pty_hi - fd_con_hi
gen dif_psi_con_hi = fd_psi_hi - fd_con_hi
gen dif_psp_con_hi = fd_psp_hi - fd_con_hi

tabstat dif_vgd_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_pty_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psi_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_pty_vgd_hi = fd_pty_hi - fd_vgd_hi
gen dif_psi_vgd_hi = fd_psi_hi - fd_vgd_hi
gen dif_psp_vgd_hi = fd_psp_hi - fd_vgd_hi

tabstat dif_pty_vgd_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psi_vgd_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_vgd_hi, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_psi_pty_hi = fd_psi_hi - fd_pty_hi
gen dif_psp_pty_hi = fd_psp_hi - fd_pty_hi

tabstat dif_psi_pty_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_pty_hi, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_psp_psi_hi = fd_psp_hi - fd_psi_hi

tabstat dif_psp_psi_hi, s(mean sd min p5 p10 p50 p90 p95 max)


* Low-knowledge high-knowledge differences

* Calculate difference in first differences

gen tr_vgd_con_lo_hi = tr_vgd_con - tr_vgd_con_hi
gen tr_pty_con_lo_hi = tr_pty_con - tr_pty_con_hi
gen tr_psi_con_lo_hi = tr_psi_con - tr_psi_con_hi
gen tr_psp_con_lo_hi = tr_psp_con - tr_psp_con_hi

tabstat tr_vgd_con_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_pty_con_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psi_con_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat tr_psp_con_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_con_lo_hi = fd_con - fd_con_hi
gen dif_vgd_lo_hi = fd_vgd - fd_vgd_hi
gen dif_pty_lo_hi = fd_pty - fd_pty_hi
gen dif_psi_lo_hi = fd_psi - fd_psi_hi
gen dif_psp_lo_hi = fd_psp - fd_psp_hi

tabstat dif_con_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_vgd_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_pty_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psi_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)


* Calculate difference in difference in first differences

gen dif_vgd_effect = dif_vgd_con - dif_vgd_con_hi
gen dif_pty_effect = dif_pty_con - dif_pty_con_hi
gen dif_psi_effect = dif_psi_con - dif_psi_con_hi
gen dif_psp_effect = dif_psp_con - dif_psp_con_hi

tabstat dif_vgd_effect, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_pty_effect, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psi_effect, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_psp_effect, s(mean sd min p5 p10 p50 p90 p95 max)


drop b1-b20
drop fd_con-dif_psp_effect

*log close


set more off

*log using "...\1805 Roadmaps\Table A5 any info.log", replace

set seed Xecab35358f70ae9e27e06ec89758e9d6000445f7


probit vote_leemar ///
     con_lo con_lo_D1 ///
     all_info_lo all_info_lo_D1 ///
     con_hi con_hi_D1 ///
     all_info_hi all_info_hi_D1 ///
     , noconstant

tabstat d1 if e(sample), s(n mean sd min p25 p50 p75 max)


estsimp probit vote_leemar ///
     con_lo con_lo_D1 ///
     all_info_lo all_info_lo_D1 ///
     con_hi con_hi_D1 ///
     all_info_hi all_info_hi_D1 ///
     , noconstant


* Low-knowledge

setx median
setx con_lo 1
setx con_lo_D1 .486
setx all_info_lo 0
setx all_info_lo_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(fd_con)) changex(con_lo_D1 .0415 1.026)


setx con_lo_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_all_info_con)) changex(con_lo 1 0 all_info_lo 0 1)


setx median
setx con_lo 0
setx con_lo_D1 0
setx all_info_lo 1
setx all_info_lo_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_all_info)) changex(all_info_lo_D1 .0415 1.026)


setx all_info_lo_D1 0
simqi, pr listx


* Difference in baseline probabilities

tabstat tr_all_info_con, s(mean sd min p5 p10 p50 p90 p95 max)


* Calculate difference in first differences

gen dif_all_info_con = fd_all_info - fd_con

tabstat dif_all_info_con, s(mean sd min p5 p10 p50 p90 p95 max)


* High-knowledge

setx median
setx con_hi 1
setx con_hi_D1 .486
setx all_info_lo 0
setx all_info_lo_D1 0
setx all_info_hi 0
setx all_info_hi_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(fd_con_hi)) changex(con_hi_D1 .0415 1.026)


setx con_hi_D1 0
simqi, pr listx

simqi, fd(prval(1) genpr(tr_all_info_con_hi)) changex(con_hi 1 0 all_info_hi 0 1)


setx median
setx con_hi 0
setx con_hi_D1 0
setx all_info_lo 0
setx all_info_lo_D1 0
setx all_info_hi 1
setx all_info_hi_D1 .486
simqi, pr listx

simqi, fd(prval(1) genpr(fd_all_info_hi)) changex(all_info_hi_D1 .0415 1.026)


setx all_info_hi_D1 0
simqi, pr listx


* Difference in baseline probabilities

tabstat tr_all_info_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)


* Calculate difference in first differences

gen dif_all_info_con_hi = fd_all_info_hi - fd_con_hi

tabstat dif_all_info_con_hi, s(mean sd min p5 p10 p50 p90 p95 max)


* Low-knowledge high-knowledge differences

* Calculate difference in first differences

gen tr_all_info_con_lo_hi = tr_all_info_con - tr_all_info_con_hi

tabstat tr_all_info_con_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)


gen dif_con_lo_hi = fd_con - fd_con_hi
gen dif_all_info_lo_hi = fd_all_info - fd_all_info_hi

tabstat dif_con_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)
tabstat dif_all_info_lo_hi, s(mean sd min p5 p10 p50 p90 p95 max)


* Calculate difference in difference in first differences

gen dif_effect = dif_all_info_con - dif_all_info_con_hi

tabstat dif_effect, s(mean sd min p5 p10 p50 p90 p95 max)


drop b1-b8
drop fd_con-dif_all_info_lo_hi

*log close

* End
